home *** CD-ROM | disk | FTP | other *** search
/ Merciful 5 / Merciful - Disc 5.iso / software / p / pcqpascalv1.2d.lha / Scripts / DME-ShowError < prev    next >
Encoding:
Text File  |  1991-09-01  |  3.2 KB  |  125 lines

  1. /*
  2.     DME-ShowError
  3.  
  4. This is an Arexx program that displays the first error generated
  5. by the PCQ Pascal compiler using Matt Dillon's DME text editor.
  6. It is designed to be used with the PCQ make utility.  To use this
  7. program, you should include the following line as one of the last
  8. commands in your .EDRC file (that's the DME configuration file):
  9.  
  10.     rx DME-ShowError
  11.  
  12. You can include a full path if necessary.  If DME was invoked
  13. through PCQ, this command will load the source file that caused
  14. the error and display the error text.  If DME was invoked
  15. normally, not through PCQ, this program will do nothing and exit
  16. immediately.  You won't even notice it.
  17.  
  18. To set up PCQ to use this system, you should include the following
  19. command in your PCQ.CFG file:
  20.  
  21.     CompilerError DME-Error \s \d \e
  22.  
  23. DME-Error is a batch file that is included in this distribution.
  24. It creates a temporary file that contains the source, destination
  25. and error file names, and also served to inform this program that
  26. there is an error to process.  DME-Error looks like this:
  27.  
  28.     .key source,dest,error
  29.     echo >T:DME-Error-Files "<source> <dest> <error>"
  30.     dme
  31.  
  32. This program deletes all the temporary files.
  33.  
  34. To use this program you'll need Arexx, of course, as well as DME.
  35. DME is a shareware text editor written by Matt Dillon that is
  36. available on several Fred Fish disks and on lots of bulletin board
  37. systems.
  38.  
  39. */
  40.  
  41.  
  42.  
  43.  
  44.  
  45. options results
  46.  
  47. /* If we aren't looking at errors, quit immediately */
  48.  
  49. if ~exists("T:DME-Error-Files") then exit
  50.  
  51. /* Read the file names */
  52.  
  53. if open(ErrorList, "T:DME-Error-Files", 'R') then do
  54.     InputLine = ReadLn(ErrorList)
  55.     parse var InputLine SourceFile OutputFile ErrorFile .
  56.     close(ErrorList)
  57. end; else exit
  58.  
  59. /* Get the first error */
  60.  
  61. if open(ErrorList, ErrorFile, 'R') then do
  62.  
  63.     if eof(ErrorList) then do   /* There were no errors */
  64.     FileName = SourceFile
  65.     LineNo = 1
  66.     ColumnNo = 1
  67.     ErrorText = "No Errors"
  68.     end; else do
  69.     ErrorString = readln(ErrorList)
  70.  
  71.     /* This first test is just a reminder, in case you want to */
  72.     /* process all errors.    "Abort" would never come first.    */
  73.  
  74.     if ErrorString = "Compilation Aborted" then do
  75.         address command 'delete >nil:' outputfile
  76.         'okay1 Compilation Aborted'
  77.         exit
  78.     end
  79.  
  80.     if ErrorString ~= "" then do
  81.         parse var ErrorString '"' FileName '" At ' LineNo,
  82.                        ',' ColumnNo ' :' ErrorText
  83.     end; else do
  84.         FileName = SourceFileName
  85.         LineNo = 1
  86.         ColumnNo = 1
  87.         ErrorText = "No Errors"
  88.     end
  89.     end
  90.     close(ErrorList)
  91. end; else exit
  92.  
  93.  
  94. /* Display the error text.  Because I can't seem to get MODIFIED to  */
  95. /* work for me, this bit here creates a temporary file and starts to */
  96. /* edit it.                                                          */
  97.  
  98. if open(ErrorList,"T:DME-Error-Files",'W') then do
  99.     Writeln(ErrorList, ' Error:' || ErrorText)
  100.     close(ErrorList);
  101. end; else exit
  102.  
  103. 'NEWFILE T:DME-Error-Files'
  104. 'RESIZE' Min(Length(ErrorText)+10,70) 3
  105.  
  106. /* Now we'll display the source file, and move to the error position */
  107.  
  108. 'OPENWINDOW +0+50-0-0'
  109. 'NEWFILE ' FileName
  110. 'GOTO ' LineNo
  111. 'FIRST'
  112.  
  113. /* This properly handles tabs */
  114.  
  115. do for ColumnNo
  116.     'RIGHT'
  117. end
  118.  
  119. /* Delete the temporary files */
  120.  
  121. address command 'delete >Nil:' ErrorFile
  122. address command 'delete >Nil:' OutputFile
  123. address command 'delete >Nil: T:DME-Error-Files'
  124.  
  125.